All Questions
676 questions
0votes
1answer
41views
Find and remove spaces in files and folders, then find patterns in files, then copy the files found
First I will describe the task I have: I have several disks I have a list of phrases (words) in a patterns.txt file that I use as search patterns I must to review the disks in search of files ...
-4votes
0answers
51views
Creating in Linux files in GB or MB range by various random size by read a file [closed]
In Linux in Bash i have this script (thanks to Ed Morton) . $ cat ./tst.sh #!/usr/bin/env bash while read -r idx sfx size; do echo fallocate "file${idx}.${sfx}" "$size" done &...
-2votes
1answer
110views
Creating in Linux files in GB or MB range by various size by read a file [closed]
In Linux with Bash, there is the File numbers_in_one_line. In this file there is only one line with several numbers, all separated by spaces. These numbers are the value in bytes for creating files ...
0votes
1answer
87views
How to create splittet random files and join them with dmsetup
In Linux in Bash, there is a script, a part of the script is this while true ; do echo awk -v x=$(<"$TEMPDIR"size_container_in_byte) -v n=$(<"$TEMPDIR"parts) 'BEGIN{...
-7votes
2answers
93views
How can I pick random items from a list, but some more often than others, in a Bash config file? [closed]
In Linux, using Bash, I have two scripts: script.sh is the main script, and script_config.sh is the configuration for script.sh. In script.sh, I do source script_config.sh to load all the config ...
-3votes
1answer
50views
Rename files, remove the first four signs [duplicate]
There are many files in this format: IMG_20240717_191421.jpg IMG_20240620_165358_BURST001_COVER.jpg IMG_20240624_173513_2.jpg how can they renamed in Linux in Bash to: 20240717_191421.jpg ...
-1votes
1answer
72views
Best tool to convert xlsx to csv
I need to install something that allow me through a script bash or if I can do it without install any external tool it would be great. The thing is I read about csvkit but is a tool of python and i ...
2votes
1answer
167views
select in a script
In Linux in Bash in a Script i use this: #!/bin/bash while true; do while true; do read -r -p 'enter number [4-999]: ' num if [[ $num =~ ^([4-9]|[1-9][0-9]{1,2})$ ]]; then ...
-4votes
2answers
110views
How to write in Linux in Bash in shellscript a part that can do something like this
How to write in Linux in Bash in shellscript a part that can do something like this enter a number must be in a range from 4-999 if not, ask again to enter enterednumber * 5 * randomnumber [1-9] (...
1vote
1answer
110views
add a randomize option in a bash script
in a bash script i do run this: seq 1 $(<howmany.txt) | xargs -I% -n1 -P$(<parallel.txt) mycommand --infile file% --option A --outfile file%.new it works. the values in howmany.txt and parallel....
0votes
0answers
26views
how to check how many loop-devices in a linux system are possible to use? [duplicate]
how to check how many loop-devices in a linux system are possible to use? i need this in a script, are not more than X possible, than end the script with some message...
0votes
2answers
44views
Capture and print on the exact match from a file
I am trying to use grep to match only a specific part of a row in a file. The file is a huge csv file with some columns containing json with commas so it is hard to figure out which column what I am ...
0votes
1answer
124views
How to add some random data at certain places in a file
With my Computer, it runs a Linux kernel and bash, i will make a technical-experiment. I have a file, file.dat, size = 1.048.576 byte. I will add at certain places in file.dat some irregular (1...8 ...
0votes
2answers
116views
How to copy the value from one "column" to another in Bash?
I have a file with lines: username="user1" email="[email protected]" I need to take the username from the email address and replace the username value with it, so the end result ...
0votes
1answer
36views
Linux Shell Script replace last shown lines at the screen, not write it under the last once
i run a script from bring formated numbers to the screen : #!/bin/sh while true ; do echo awk -v x=987654321 -v n=8 'BEGIN{srand(); while (--n) {$++NF = int(rand() * x / n); x -= $NF}; $++NF =...